﻿using System.Web.UI;
using BigfootWeb.Helpers;

namespace BigfootWeb
{
    public abstract class BasicUserControl : UserControl
    {

        public abstract ViewHelper V { get; }

        ///// <summary>
        ///// Contains the HTML helpers you can use in the views. It is an alias class that provides easy access to the HTMLHelper class.
        ///// </summary>
        //public class Html : HtmlHelper { }

        ///// <summary>
        ///// Contains the Javascript helpers you can use in the views. It is an alias class that provides easy access to the JSHelper class.
        ///// </summary>
        //public class JS : JSHelper { }

        ///// <summary>
        ///// This is a general purpose html tag builder class. It is an alias class that provides easy access to the HtmlHelper.TagBuilder class.
        ///// </summary>
        //public HtmlHelper.TagBuilder TB(string tagName) { return new HtmlHelper.TagBuilder(tagName); }

        ///// <summary>
        ///// Creates a new AJAX request object you can build on in order to make ajax call to the server
        ///// </summary>
        ///// <param name="url">The url agains which you are executing the ajax request</param>
        //public AjaxRequest Ajax(string url) { return AjaxRequest.Create(url); }

        ///// <summary>
        ///// Creates a partial from. Partial forms are a way to make field groups within a form behave like a form
        ///// for the purposes of validation, and POST.
        ///// </summary>
        ///// <param name="formId">The element id that wraps the field group (i.e. div etc)</param>
        ///// <returns>A script to ouputed on the page</returns>
        //public string CreatePartialForm(string formId) { return JSHelper.CreatePartialForm(formId); }

        ///// <summary>
        ///// Submits a partial from. Partial forms are a way to make field groups "Partial Form" within a form behave like a form
        ///// for the purposes of validation, and POST.
        ///// </summary>
        ///// <param name="formId">The element id that wraps the field group "Partial Form" (i.e. div etc)</param>
        ///// <param name="url">The url you would like to submit the form to</param>
        ///// <returns>AJAX Request object upon which you can build other actions, like clearing the contents of a field upon callback etc.</returns>
        //public AjaxRequest SubmitPartialForm(string formId, string url) { return JSHelper.SubmitPartialForm(formId, url); }

        ///// <summary>
        ///// Submits a partial from. Partial forms are a way to make field groups "Partial Form" within a form behave like a form
        ///// for the purposes of validation, and POST.
        ///// </summary>
        ///// <param name="formId">The element id that wraps the field group "Partial Form" (i.e. div etc)</param>
        ///// <param name="url">The url you would like to submit the form to</param>
        ///// <param name="validate">Determines weather to validate the form before submission or not</param>
        ///// <returns>AJAX Request object upon which you can build other actions, like clearing the contents of a field upon callback etc.</returns>
        //public AjaxRequest SubmitPartialForm(string formId, string url, bool validate) { return JSHelper.SubmitPartialForm(formId, url, validate); }

        ///// <summary>
        ///// A helper builder function that outputs the text only if the specified condition is true
        ///// (i.e. <%=RenderIf(user.HasGrups, user.GroupString)%>
        ///// </summary>
        ///// <param name="condition">The condition that determines weather the text is rendered or not</param>
        ///// <param name="text">The text / html to render if the condition is true </param>
        ///// <returns>Returns the RenderIfBuilder upon which you can further build with an .else statement other if conditions etc.</returns>
        //public HtmlHelper.RenderIfBuilder RenderIf(bool condition, string text) { return Html.RenderIf(condition, text); }

        ///// <summary>
        ///// HtmlEncode the string for output
        ///// </summary>
        ///// <param name="data">The string to be encoded</param>
        ///// <returns>HtmlEncoded string</returns>
        //public string E(string data)
        //{
        //    return HttpUtility.HtmlEncode(data);
        //}

        ///// <summary>
        ///// Quick access to the String.Format function
        ///// </summary>
        ///// <param name="value">The string where the values will be inserted i.e. The bird flew {0} miles</param>
        ///// <param name="values">The values to merge with the format string</param>
        ///// <returns>The formated string</returns>
        //public string F(string value, params string[] values)
        //{
        //    return string.Format(value, values);
        //}

        ///// <summary>
        ///// Creates a properly formated url parameter. 
        ///// </summary>
        ///// <param name="paramName">The name of the url parameter</param>
        ///// <param name="value">The value of the url parameter</param>
        ///// <returns>The properly formatted parameter i.e. parameter=value</returns>
        //public string UrlP(string paramName, string value)
        //{
        //    return paramName + "=" + value;
        //}

        ///// <summary>
        ///// Creates a properly formated url parameter. 
        ///// </summary>
        ///// <param name="paramName">The name of the url parameter</param>
        ///// <param name="value">The integer value of the url parameter</param>
        ///// <returns>The properly formatted parameter i.e. parameter=value</returns>
        //public string UrlP(string paramName, int value)
        //{
        //    return paramName + "=" + value;
        //}

        ///// <summary>
        ///// Easy access to the UrlBuilder class. Aids in the fluid creation of urls and url parameters
        ///// </summary>
        //public UrlBuilder QS { get { return new UrlBuilder(); } }


        ///// <summary>
        ///// Class used to aid in the collection of posted values from the request. First it tries the QueryString and second it tries the form collection
        ///// </summary>
        //public PostHelper Values
        //{
        //    get
        //    {
        //        return _values ?? (_values = new PostHelper(HttpContext.Current.Request));
        //    }
        //}
        //private PostHelper _values;

        ///// <summary>
        ///// Render a partial view onto a temporary page, execute it and return the resulting markup string.
        ///// </summary>
        ///// <param name="server">This is the server object that will be used to execute the usercontrol output</param>
        ///// <param name="viewRelativePath">The relative path of the user control to render. i.e. ~/views/test.ascx</param>
        ///// <returns>The rendered string ouput</returns>
        //public string RenderPartial(HttpServerUtility server, string viewRelativePath)
        //{
        //    return WebApp.RenderViewToString(server, viewRelativePath, null, null, null);
        //}

        ///// <summary>
        ///// Render a partial view onto a temporary page, execute it and return the resulting markup string.
        ///// </summary>
        ///// <param name="server">This is the server object that will be used to execute the usercontrol output</param>
        ///// <param name="viewRelativePath">The relative path of the user control to render. i.e. ~/views/test.ascx</param>
        ///// <param name="data">Assigns this object to the ModelData property (if it exists) of the view being rendered</param>
        ///// <returns>The rendered string ouput</returns>
        //public string RenderPartial(HttpServerUtility server, string viewRelativePath, object data)
        //{
        //    return WebApp.RenderViewToString(server, viewRelativePath, data, null, null);
        //}

        ///// <summary>
        ///// Render a partial view onto a temporary page, execute it and return the resulting markup string.
        ///// </summary>
        ///// <param name="server">This is the server object that will be used to execute the usercontrol output</param>
        ///// <param name="viewRelativePath">The relative path of the user control to render. i.e. ~/views/test.ascx</param>
        ///// <param name="data">Assigns this object to the ModelData property (if it exists) of the view being rendered</param>
        ///// <param name="loadField1Name">Assigns the loadField1Data value to a property or field with this name on the rendered view</param>
        ///// <param name="loadField1Data">Value to assign the loadField1Name property or field</param>
        ///// <returns>The rendered string ouput</returns>
        //public string RenderPartial(HttpServerUtility server, string viewRelativePath, object data, string loadField1Name, object loadField1Data)
        //{
        //    return WebApp.RenderViewToString(server, viewRelativePath, data, loadField1Name, loadField1Data);
        //}
    }
}
